package com.learnosity.extendotext.style
{
	import com.learnosity.extendotext.Rule;
	import flash.text.engine.ElementFormat;
		
	public class FontSize
	{

		static public function apply(rule:Rule,format:ElementFormat):ElementFormat{
			//Is this a percentage value?
			if(rule.value.indexOf('%') != -1){
				var percent:Number = Number(rule.value.replace('%',''));
				format.fontSize = format.fontSize * (percent/100);
			}
			//else assume a pixel value
			else
			{
				format.fontSize = parseInt(rule.value,10);			
			}				
			return format;
		}

	}
}